package learning.systemMethod;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.FileReader;
import java.io.IOException;

public class ByteArrayOutputStream2 {
	public static void main(String[] args) {
		BufferedReader rd=null;
		ByteArrayOutputStream bos=new ByteArrayOutputStream();
		try {
			rd=new BufferedReader(new FileReader("myfile/my.txt"));
			String str=null;
			while((str=rd.readLine())!=null){
				bos.write(str.getBytes());
				p(bos.toString());
			}
//			bos.write("I come from China".getBytes());
//			bos.flush();
//			p(bos.toByteArray());
//			bos.close();
//			p(bos.toString());
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
     
	static void p(Object o){
		System.out.println(o);
	}
}